package com.powernode.controller;

import com.powernode.domain.Area;
import com.powernode.model.Result;
import com.powernode.service.AreaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description:
 * @Author: Tong Ziyu
 * @Date: 2025/4/26 19:53
 */
@RestController
@Slf4j
@Api(tags = "区域管理")
@RequestMapping("admin")
public class AreaController {

    @Autowired
    private AreaService areaService;

    @ApiOperation("查询所有区域")
    @GetMapping("area/list")
    @PreAuthorize("hasAuthority('admin:area:list')")
    public Result<List<Area>> loadAreaList(){
        return Result.success(areaService.queryAreaList());
    }

}
